*****************************************************************************
* This code produces results from analysis of cross-sectional 
* district-level votes data from Switzerland
* Michael Becher (michael.becher@ie.edu); March 13, 2025
****************************************************************************

****************************
** Required packages
* plausexog
* weakivtest
* avar
**To install, run
* ssc install plausexog
* ssc install avar
* ssc install weakivtest
****************************

*log using an_votes_log, replace

use Votes, clear

**Set graph scheme (only used for Appendix figures) or comment it out if you prefer default
*if lean2 schme is not installed, run
*net install gr0002_3, from(http://www.stata-journal.com/software/sj4-3)
set scheme lean2

**Define controls
*district level controls from 1900 population census
global census_controls "pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900"
*Structure of agriculture (from 1905 firm census)
global agric_controls "lgini meadowspasture mfsize"
*Structure of industry (from 1905 firm census)
global ind_controls "I_women I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst"
*Human capital or skil formation
global skill_controls "S_voc"
*Other votes
global other_votes "V_bundesbank1897  V_constitution1897  V_food1897 V_railroad1898 V_const_art64_1898 V_const_art64bis_1898 V_socialins1900 V_election_bundesrat1900 V_schools1902"

****************************************
*
*FIGURES AND TABLES IN MAIN TEXT
*
*****************************************

*******
*TABLE 1: protectionism and support for PR 1910 and 1918
**********

eststo clear
**1910 vote
*Baseline: canton FE
eststo: reg pr10 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo: reg pr10 protectionism f1_other_votes_until1902 i.knum, robust
*Add all district controls
eststo:  reg pr10 protectionism  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
*Double selection lasso linear model
local cvars "pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc f1_other_votes_until1902"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo: dsregress pr10 protectionism, controls((i.knum) `controls')

**1918 vote
*Baseline: canton FE
eststo: reg pr18 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo:  reg pr18 protectionism f1_other_votes_until1902 i.knum, robust
*Add all  district controls
eststo: reg pr18 protectionism  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
*Double selection lasso linear model
eststo: dsregress pr18 protectionism, controls((i.knum) `controls')
*display e(controls_sel)	
esttab using "output/table1.tex", label r2 dep nocons replace ///
	keep(protectionism) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
	stats(r2  N, fmt(%6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "DSLR" "OLS" "OLS" "OLS" "DSLR") ///
	mgroups("Vote for introduction of PR (1910)" "Vote for introduction of PR (1918)" , pattern(1 0 0 0 1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
	

	
********
*Joint significance industry
********

qui reg pr10 protectionism  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
testparm I*
	
	


*********************************
*
*FIGURES AND TABLES IN ONLINE APPENDIX
*
***********************************


*******************
*Table A1: Descriptive statistics
********************


tabstat protectionism pr10 pr18 f1_other_votes_until1902 sector11900 pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize I_women  I_afood I_bclothes I_cbuild  I_dtext I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst S_voc, statistics(mean sd n) columns(statistics) format(%9.2fc)


*******************
*TABLE B.1: agriculture and the support for protectionism
********************


eststo clear
eststo: reg protectionism sector11900, robust
eststo: reg protectionism sector11900  i.knum, robust
eststo: reg protectionism sector11900 $census_controls i.knum, robust
eststo: reg  protectionism sector11900 $census_controls $agric_controls $ind_controls $skill_controls  i.knum, robust
eststo: reg  protectionism sector11900 $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902  i.knum, robust
**Double selection lasso linear model
local cvars "pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc f1_other_votes_until1902"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo: dsregress protectionism sector11900, controls((i.knum) `controls') 
display e(controls_sel)	
	
esttab using "output/tableB1.tex", label r2 dep nocons replace ///
	keep(sector11900) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
		stats(r2  N, fmt( %6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "OLS" "OLS" "DSR") ///
	mgroups("Vote for protectionist general tariff (1903)" , pattern(1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))



*******************
*TABLE B.2: agriculture and the support for protectionism and exploring between-industry differences cond on second sector size
********************

eststo clear
eststo: reg protectionism sector11900 sector21900 I_afood I_bclothes I_cbuild I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst, robust
testparm I_*
estadd scalar p_fstat = r(p)
eststo: reg protectionism sector11900 sector21900 I_afood I_bclothes I_cbuild I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst  i.knum, robust
testparm I_*
estadd scalar p_fstat = r(p)
eststo: reg protectionism sector11900 sector21900 I_afood I_bclothes I_cbuild I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst $census_controls i.knum, robust
testparm I_*
estadd scalar p_fstat = r(p)
eststo: reg  protectionism sector11900 sector21900 I_afood I_bclothes I_cbuild I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst $census_controls $agric_controls $skill_controls f1_other_votes_until1902  i.knum, robust
testparm I_*
estadd scalar p_fstat = r(p)
**Double selection lasso linear model
local cvars "sector21900 I_afood I_bclothes I_cbuild I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize S_voc  f1_other_votes_until1902"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo: dsregress protectionism sector11900, controls((i.knum) `controls') 
display e(controls_sel)	
	
esttab using "output/tableB2.tex", label r2 dep nocons replace ///
	keep(sector11900 sector21900 I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
		stats(r2  N p_fstat, fmt( %6.2f  %15.0fc %6.3f) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "OLS" "DSR") ///
	mgroups("Vote for protectionist general tariff (1903)" , pattern(1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))

	

*******************
*Table B.3: Heterogeneity: Agriculture and protectionism
********************


**standardize variables for ease of interpretation
foreach var of varlist protectionism sector11900 $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 {

    egen float `var'_z = std(`var')

    }
	
**define control sets
global census_controls_z "pop1900log_z german1900_z protestant1900_z ethnofrac1900_z religfrac1900_z"
global agric_controls_z "lgini_z meadowspasture_z mfsize_z"
global ind_controls_z "I_women_z I_afood_z I_bclothes_z I_cbuild_z  I_epaplk_z I_fchem_z I_gmetall_z I_hprint_z I_iwaten_z I_kinst_z"

eststo clear
eststo: reg  protectionism c.sector11900##c.protestant1900_z $census_controls_z $agric_controls_z $ind_controls_z S_voc_z f1_other_votes_until1902_z  i.knum, robust
eststo: reg  protectionism c.sector11900##c.religfrac1900_z $census_controls_z $agric_controls_z $ind_controls_z S_voc_z f1_other_votes_until1902_z  i.knum, robust
eststo: reg  protectionism c.sector11900##c.lgini_z $census_controls_z $agric_controls_z $ind_controls_z S_voc_z f1_other_votes_until1902_z  i.knum, robust
eststo: reg  protectionism c.sector11900##c.meadowspasture_z $census_controls_z $agric_controls_z $ind_controls_z S_voc_z f1_other_votes_until1902_z  i.knum, robust
eststo: reg  protectionism c.sector11900##c.mfsize_z $census_controls_z $agric_controls_z $ind_controls_z S_voc_z f1_other_votes_until1902_z  i.knum, robust
esttab using "output/tableB3.tex", label r2 dep nocons replace ///
	keep(sector11900 c.sector11900#c.protestant1900_z c.sector11900#c.religfrac1900_z  c.sector11900#c.lgini_z c.sector11900#c.meadowspasture_z c.sector11900#c.mfsize_z) ///
	cells(b(star fmt(%15.3fc)) se(par fmt(%15.3fc))) ///
	star(* 0.05) ///
		stats(r2  N, fmt(%6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "OLS" "OLS") ///
	mgroups("Vote for protectionist general tariff (1903)" , pattern(1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))



************
*FIGURE B.1: Partial regression plot based on Table 1
************

*Panel a
qui reg pr10 f1_other_votes_until1902 i.knum, robust
predict resids_y_fe, residuals
qui reg protectionism f1_other_votes_until1902 i.knum, robust
predict resids_x_fe, residuals
twoway scatter resids_y_fe resids_x_fe,  title("(a)") ytitle("Vote for PR (1910)") xtitle("Vote for protectionism (1903)") msymbol(O) ysize(4.5) xsize(4.5) || lfit  resids_y_fe resids_x_fe, legend(off) lpattern(solid) lwidth(1.5) lcolor(red%60) saving(output/fig_partiala, replace)
*Panel b
qui reg pr10  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
predict resids_y_full, residuals
qui reg protectionism  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
predict resids_x_full, residuals
twoway scatter resids_y_full resids_x_full,  title("(b)") ytitle("Vote for PR (1910)") xtitle("Vote for protectionism (1903)") msymbol(O) ysize(4.5) xsize(4.5) || lfit  resids_y_full resids_x_full, legend(off) lpattern(solid) lwidth(1.5) lcolor(red%60) saving(output/fig_partialb, replace)
*Combine plots and save 
graph combine output/fig_partiala.gph output/fig_partialb.gph, xcommon ycommon cols(2) ysize(4.5) xsize(9)
graph export output/FigureB1.pdf, replace

*******
*TABLE B.4: protectionism and support for PR: Alternative control for bundling based on party endorsements
**********

eststo clear
**1910 vote
*Baseline: canton FE
eststo:  reg pr10 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo: reg pr10 protectionism V_sd i.knum, robust
*Add all district controls
eststo:  reg pr10 protectionism  V_sd  $census_controls $agric_controls $ind_controls $skill_controls i.knum, robust
*Double selection lasso linear model
local cvars "pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc V_sd"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects;
eststo: dsregress pr10 protectionism, controls((i.knum) `controls')
display e(controls_sel)	
**1918 vote
*Baseline: canton FE
eststo:  reg pr18 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo: reg pr18 protectionism  V_sd i.knum, robust
*Add all  district controls
eststo:  reg pr18 protectionism   V_sd $census_controls $agric_controls $ind_controls $skill_controls i.knum, robust
*Double selection lasso linear model
eststo: qui dsregress pr18 protectionism, controls((i.knum) `controls')
display e(controls_sel)	
esttab using "output/tableB4.tex", label r2 dep nocons replace ///
	keep(protectionism) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
	stats(r2  N, fmt(%6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "DSLR" "OLS" "OLS" "OLS" "DSLR") ///
	mgroups("Vote for introduction of PR (1910)" "Vote for introduction of PR (1918)" , pattern(1 0 0 0 1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
	
	
	
**************
*TABLE B.5:protectionism and support for PR: Alternative control for bundling based - individually including other votes
****************

eststo clear
**1910 vote
*Baseline: canton FE
eststo: qui reg pr10 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo: qui reg pr10 protectionism $other_votes i.knum, robust
*Add all district controls
eststo:  reg pr10 protectionism  $other_votes $census_controls $agric_controls $ind_controls $skill_controls i.knum, robust
*Double selection lasso linear model
local cvars "pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc V_bundesbank1897  V_constitution1897  V_food1897 V_railroad1898 V_const_art64_1898 V_const_art64bis_1898 V_socialins1900 V_election_bundesrat1900 V_schools1902"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo: qui dsregress pr10 protectionism, controls((i.knum) `controls')
display e(controls_sel)	
**1918 vote
*Baseline: canton FE
eststo: qui reg pr18 protectionism  i.knum, robust
estadd local Canton_FE "\checkmark"
*Add other votes (to address bundling)
eststo: qui reg pr18 protectionism  $other_votes i.knum, robust
*Add all  district controls
eststo: qui reg pr18 protectionism   $other_votes $census_controls $agric_controls $ind_controls $skill_controls i.knum, robust
*Double selection lasso linear model
eststo: qui dsregress pr18 protectionism, controls((i.knum) `controls')
display e(controls_sel)	
esttab using "output/tableB5.tex", label r2 dep nocons replace ///
	keep(protectionism) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
	stats(r2  N, fmt(%6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "DSLR" "OLS" "OLS" "OLS" "DSLR") ///
	mgroups("Vote for introduction of PR (1910)" "Vote for introduction of PR (1918)" , pattern(1 0 0 0 1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
	

	
********
*Joint significance industry
********

qui reg pr10 protectionism  $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902 i.knum, robust
testparm I*
	
********************
*Table B.6: Jointly modeling agriculture, protectionism, and support for PR (2SLS)
*********************

eststo clear
eststo: qui ivregress 2sls pr10 (protectionism = sector11900), robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
eststo: qui ivregress 2sls pr10 (protectionism = sector11900) i.knum, robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
eststo: qui ivregress 2sls pr10 (protectionism = sector11900 ) $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902  i.knum, robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
eststo: qui  ivregress 2sls pr18 (protectionism = sector11900), robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
eststo: qui ivregress 2sls pr18 (protectionism = sector11900) i.knum, robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
eststo: qui  ivregress 2sls pr18 (protectionism = sector11900 ) $census_controls $agric_controls $ind_controls $skill_controls f1_other_votes_until1902  i.knum, robust
qui weakivtest
estadd scalar Fstat = r(F_eff)
esttab using "output/tableB6.tex", label r2 dep nocons replace ///
	keep(protectionism) ///
	cells(b(star fmt(%15.3fc)) se(par fmt(%15.3fc))) ///
	star(* 0.05) ///
		stats(Fstat r2  N, fmt(%15.1f  %6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("First-stage F-Stat" "R2"  "Observations")) ///
	collabels(none) mlabels("2SLS" "2SLS" "2SLS" "2SLS" "2SLS" "2SLS") ///
	mgroups("Vote for introduction of PR (1910)" "Vote for introduction of PR (1918)" , pattern(1 0 0 1 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))


	
************
*FIGURE B.2: Sensitivity of IV estimates to local violations of exclusion restrictions 
************

**Inference relaxing exact exclusion restriction
qui tabulate knum, gen(Kanton)
plausexog ltz pr10 pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900  lgini meadowspasture mfsize S_voc f1_other_votes_until1902 Kanton2-Kanton25 (protectionism = sector11900), omega(0.01) mu(-0.05) graph(protectionism) graphomega(0.010000 0.005625 0.002500 0.000625 0.000000 0.000625 0.002500 0.005625 0.010000) graphmu(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1)  graphdelta(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1) scheme(lean2) title("(a) 1910 PR vote") ytitle(Estimated {&beta}) xtitle(Assumed mean of {&delta} under violation of exclusion restriction) legend(off)  xlabel(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1) saving(output/fig_iva, replace)

**legend(order(1 "Point estimate (LTZ)" 2 "95% Confidence intervals (LTZ)") position(0) bplacement(neast))

plausexog ltz pr18 pop1900log german1900 protestant1900 ethnofrac1900 religfrac1900  lgini meadowspasture mfsize S_voc f1_other_votes_until1902 Kanton2-Kanton25 (protectionism = sector11900), omega(0.01) mu(-0.05) graph(protectionism) graphomega(0.010000 0.005625 0.002500 0.000625 0.000000 0.000625 0.002500 0.005625 0.010000) graphmu(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1)  graphdelta(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1) scheme(lean2) title("(b) 1918 PR vote")  ytitle(Estimated {&beta}) xtitle(Assumed mean of {&delta} under violation of exclusion restriction) legend(off)  xlabel(-0.1 -0.075 -0.05 -0.025 0.0 0.025 0.05 0.075 0.1) saving(output/fig_ivb, replace)


*Combine plots and save 
graph combine output/fig_iva.gph output/fig_ivb.gph, xcommon ycommon cols(1) ysize(9) xsize(9)
graph export output/FigureB2.pdf, replace


************
*FIGURE B.3: Agriculture and votes, partial regression plots 
************

*Estimates in figure caption
reg protectionism sector11900   i.knum, robust
reg  V_food1906 sector11900   i.knum, robust
reg V_military1907 sector11900   i.knum, robust
reg pr10 sector11910   i.knum, robust

*Panel a
qui reg protectionism  i.knum, robust
predict resids_tarif_fe, residuals
qui reg sector11900 i.knum, robust
predict resids_agric_fe, residuals
twoway scatter resids_tarif_fe resids_agric_fe,  ///
title("(a)") ytitle("Vote for Tariff (1903)", size(10pt) margin(vsmall)) xtitle("Agricultural workforce (1900, share)", size(11pt)) || ///
lfit  resids_tarif_fe resids_agric_fe, legend(off) lpattern(solid) lwidth(1.2) lcolor(red%60) saving(output/fig_agric_a, replace)

*Panel b
qui reg V_food1906  i.knum, robust
predict resids_food_fe, residuals
twoway scatter resids_food_fe resids_agric_fe,  ///
title("(b)") ytitle("Vote for law on food" "and consumer goods (1906)",  size(10pt) margin(vsmall)) xtitle("Agricultural workforce (1900, share)", size(11pt)) || ///
lfit  resids_food_fe resids_agric_fe, legend(off) lpattern(solid) lwidth(1.5) lcolor(red%60) saving(output/fig_agric_b, replace)

*Panel c
qui reg V_military1907 i.knum, robust
predict resids_mil_fe, residuals
twoway scatter resids_mil_fe resids_agric_fe,  ///
title("(c)") ytitle("Vote for military reform (1907)", size(10pt) margin(vsmall)) xtitle("Agricultural workforce (1900, share)", size(11pt)) || ///
lfit resids_mil_fe resids_agric_fe, legend(off) lpattern(solid) lwidth(1.5) lcolor(red%60) saving(output/fig_agric_c, replace)

*Panel d
qui reg pr10  i.knum, robust
predict resids_pr_fe, residuals
qui reg sector11910 i.knum, robust
predict resids_agric10_fe, residuals
twoway scatter resids_pr_fe resids_agric10_fe,  ///
title("(d)") ytitle("Vote for PR (1910)",  size(10pt) margin(vsmall)) xtitle("Agricultural workforce (1900, share)", size(11pt)) || ///
lfit  resids_pr_fe resids_agric10_fe, legend(off) lpattern(solid) lwidth(1.5) lcolor(red%60) saving(output/fig_agric_d, replace)
**ysize(4.5) xsize(4.5) || ///

*Combine plots and save 
graph combine output/fig_agric_a.gph output/fig_agric_b.gph  output/fig_agric_c.gph  output/fig_agric_d.gph, xcommon ycommon cols(2) ysize(9) xsize(9)
graph export output/FigureB3.pdf, replace


*****************
*Table B.8: Cross-sectional analysis of agricultural and support for PR
*******************

global census_controls1910 "pop1910log german1910 protestant1910 ethnofrac1910 religfrac1910"
global census_controls1920 "pop1920log german1920 protestant1920 ethnofrac1920 religfrac1920"

eststo clear
*eststo: reg pr10  sector11910, robust
eststo: reg pr10  sector11910  i.knum, robust
eststo: reg pr10  sector11910 $census_controls1910 i.knum, robust
eststo: reg  pr10  sector11910 $census_controls1910 $agric_controls $ind_controls $skill_controls f1_other_votes_until1902  i.knum, robust
**Double selection lasso linear model
local cvars "pop1910log german1910 protestant1910 ethnofrac1910 religfrac1910 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc f1_other_votes_until1902"
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo:  dsregress pr10  sector11910, controls((i.knum) `controls') 
display e(controls_sel)	
eststo: reg pr18  sector11920  i.knum, robust
eststo: reg pr18  sector11920 $census_controls1920 i.knum, robust
eststo: reg  pr18  sector11920 $census_controls1920 $agric_controls $ind_controls $skill_controls f1_other_votes_until1902  i.knum, robust
**Double selection lasso linear model
local cvars "pop1920log german1920 protestant1920 ethnofrac1920 religfrac1920 lgini meadowspasture mfsize I_afood I_bclothes I_cbuild  I_epaplk I_fchem I_gmetall I_hprint I_iwaten I_kinst I_women S_voc f1_other_votes_until1902 "
local controls `cvars' c.(`cvars')# c.(`cvars')
*always keep canton fixed effects
eststo:  dsregress pr18  sector11920, controls((i.knum) `controls') 
display e(controls_sel)	
	
esttab using  "output/tableB8.tex", label r2 dep nocons replace ///
	keep(sector11910 sector11920) ///
	cells(b(star fmt(%15.2fc)) se(par fmt(%15.2fc))) ///
	star(* 0.05) ///
	stats(r2  N, fmt(%6.2f  %15.0fc ) layout(@ @ @ @ @) ///
	labels("R$^2$"  "Observations")) ///
	collabels(none) mlabels("OLS" "OLS" "OLS" "DSLR" "OLS" "OLS" "OLS" "DSLR") ///
	mgroups("Vote for introduction of PR (1910)" "Vote for introduction of PR (1918)" , pattern(1 0 0 0 1 0 0 0) ///
	prefix(\multicolumn{@span}{c}{) suffix(}) span erepeat(\cmidrule(lr){@span}))
	
*log close
